package typechecker.walkers;


import typechecker.Stage;
import typechecker.ast.type.ForallType;
import typechecker.ast.type.FunctionType;
import typechecker.ast.type.TypeConstructorApplication;
import typechecker.ast.type.TypeExpression;
import typechecker.ast.type.TypeVariable;

public class NTAnnot {

	private static void annotConstructorApplication(TypeConstructorApplication tca){
		tca.getCons().setStage(Stage.NONTERM);
		
		for(TypeExpression param : tca.getParams()){
			annot(param);
		}
	}

	private static void annotFunctionType(FunctionType ft){
		annot(ft.getSrc());
		annot(ft.getDest());
	}

	private static void annotForallType(ForallType ft){
		annot(ft.getBody());
	}
	
	
	private static void annotVariable(TypeVariable tv){
	}
	
	public static void annot(TypeExpression te){
		if (te instanceof ForallType){
			annotForallType((ForallType)te);
		} else if ( te instanceof FunctionType){
			annotFunctionType((FunctionType)te);
		} else if ( te instanceof TypeConstructorApplication){
			annotConstructorApplication((TypeConstructorApplication) te);
		} else if ( te instanceof TypeVariable){
			annotVariable((TypeVariable)te);
		}
	}

}
